{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block page_title %}评论管理{% endblock %}

{% block page_content%}
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-3 col-md-2 sidebar">
                    <ul class="nav nav-sidebar">
                        <li><a href="{{ url_for('manage.manage_blogs') }}">日志管理 <span class="sr-only">(current)</span></a></li>
                        <li><a href="{{ url_for('manage.manage_users') }}">用户管理</a></li>
                        <li class="active"><a href="{{ url_for('manage.manage_comments') }}">评论管理</a></li>
                    </ul>
                </div>
                <div class="col-sm-3 col-md-9 main">
                <h2 class="page-header">评论管理</h2>
                <div class="table-responsive">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th class="th-left">作者</th>
                                <th class="th-left">内容</th>
                                <th>发表日期</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for comment in comments %}
                            <tr>
                                <td class="th-left">{{ comment.author.username }}</td>
                                <td class="th-left">{% if comment.disabled %}<b>[封禁]</b>{% endif %}{{ comment.content[:40] }}</td>
                                <td>{{ moment(comment.create_at).format('YYYY-MM-DD hh:mm:ss') }}</td>
                                <td>
                                    {% if not comment.disabled %}
                                    <a href="{{ url_for('manage.disable_comment', id=comment.id, page=page) }}"><span class="glyphicon glyphicon-remove" aria-hidden="true">-屏蔽</span></a>
                                    {% else %}
                                    <a href="{{ url_for('manage.enable_comment', id=comment.id, page=page) }}"><span class="glyphicon glyphicon-ok" aria-hidden="true">-恢复</span></a>
                                    {% endif %}
                                </td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
{% if pagination %}
<div class="pagination-manage">
    <div class="pagination-Nav">
        {{ macros.pagination_widget(pagination, 'manage.manage_comments') }}
    </div>
</div>
{% endif %}
{% endblock %}